#ifndef __MOTOR_H__
#define __MOTOR_H__
#include "common.h"
#include "headfile.h"


#define Right_MOTOR2_PWM  ATOM0_CH7_P02_7
#define Right_MOTOR1_PWM  ATOM0_CH6_P02_6
#define Left_MOTOR2_PWM ATOM0_CH5_P02_5
#define Left_MOTOR1_PWM ATOM0_CH4_P02_4
#define MOTOR_HZ       17000
extern int32   Left_MOTOR_Duty  ;
extern int32   Right_MOTOR_Duty ;
extern int32   MOTOR_Speed;
extern int32   Speed_motor_duty;
extern int32   goal_speed;
extern int32   Left_MOTOR_Really_Speed;
extern int32   Right_MOTOR_Really_Speed;
extern uint8    start_manual;

int32 motor_range_protect(int32 duty, int32 min, int32 max);
extern int32   left_goal_speed ;
extern int32   right_goal_speed ;
void motor_init();
void speed_measure();
void motor_control(int32 direction_data,int32 speed_data);
void motor_export();


#endif